-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
get stake interface in solidity #955
base: devnet-ready
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, can we get a test?
|
Please implement the e2e test for this as a separate test and let it fail. When we merge to devnet-ready, the tests will be passing. |
https://github.com/opentensor/subtensor-js-tests/blob/main/src/evm/eth.staking.precompile.test.js#L215 separate test case is added. |
It would be great to have this merged ! Thanks for this PR. |
* @param coldkey The coldkey public key (32 bytes). | ||
* @return The current stake amount in uint64 format. | ||
*/ | ||
function getStake(bytes32 hotkey, bytes32 coldkey) external view returns (uint64); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function getStake(bytes32 hotkey, bytes32 coldkey) external view returns (uint64); | |
function getStake(bytes32 hotkey, bytes32 coldkey, uint16 netuid) external view returns (uint64); |
* It is a view function, meaning it does not modify the state of the contract and is free to call. | ||
* | ||
* @param hotkey The hotkey public key (32 bytes). | ||
* @param coldkey The coldkey public key (32 bytes). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param coldkey The coldkey public key (32 bytes). | |
* @param coldkey The coldkey public key (32 bytes). | |
* @param netuid The subnet the stake is on (uint16). |
@@ -59,6 +59,9 @@ impl StakingPrecompile { | |||
id if id == get_method_id("removeStake(bytes32,uint256,uint16)") => { | |||
Self::remove_stake(handle, &method_input) | |||
} | |||
id if id == get_method_id("getStake(bytes32,bytes32)") => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
id if id == get_method_id("getStake(bytes32,bytes32)") => { | |
id if id == get_method_id("getStake(bytes32,bytes32,uint16)") => { |
Needs the |
Will update it after RAO feature merged. Now, we can use the netuid in nowhere. |
Description
The PR add the stake data access in solidity precompile contract.
Related Issue(s)
Type of Change
Breaking Change
If this PR introduces a breaking change, please provide a detailed description of the impact and the migration path for existing applications.
Checklist
cargo fmt
andcargo clippy
to ensure my code is formatted and linted correctlyScreenshots (if applicable)
Please include any relevant screenshots or GIFs that demonstrate the changes made.
Additional Notes
Please provide any additional information or context that may be helpful for reviewers.